{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import sqlalchemy\n",
    "import pandas as pd\n",
    "import datetime\n",
    "import random"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sqlalchemy import create_engine\n",
    "conn = create_engine('mysql+pymysql://root:12345@localhost:3306/recommend2?charset=utf8')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "current_day = '2020-07-01'\n",
    "last_day = '2020-06-29'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. 每个销售人员每天接受25个沟通新量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>customer_id</th>\n",
       "      <th>tel</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>539</td>\n",
       "      <td>6f7602c534ce83d367b3c53a4f36c0b7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>540</td>\n",
       "      <td>d750c7b30e85efceb15f9838548fc085</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>541</td>\n",
       "      <td>4fcd26ac2390e3f54d1a72b87ba4c77c</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>542</td>\n",
       "      <td>7c134ea8df6ab6e78143eba0a3445e6e</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>543</td>\n",
       "      <td>0c883e4a18c193c84e9c4785adb4d847</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   customer_id                               tel\n",
       "0          539  6f7602c534ce83d367b3c53a4f36c0b7\n",
       "1          540  d750c7b30e85efceb15f9838548fc085\n",
       "2          541  4fcd26ac2390e3f54d1a72b87ba4c77c\n",
       "3          542  7c134ea8df6ab6e78143eba0a3445e6e\n",
       "4          543  0c883e4a18c193c84e9c4785adb4d847"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 新客户\n",
    "sql1 = 'select id as customer_id,tel from customer where id not in (select customer_id from mission group by customer_id);'\n",
    "df_customer = pd.read_sql(sql1,conn)\n",
    "df_customer.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1,\n",
       " 2,\n",
       " 3,\n",
       " 4,\n",
       " 5,\n",
       " 6,\n",
       " 7,\n",
       " 8,\n",
       " 9,\n",
       " 10,\n",
       " 11,\n",
       " 12,\n",
       " 13,\n",
       " 14,\n",
       " 15,\n",
       " 16,\n",
       " 17,\n",
       " 18,\n",
       " 19,\n",
       " 20,\n",
       " 21,\n",
       " 22,\n",
       " 23,\n",
       " 24,\n",
       " 25,\n",
       " 26,\n",
       " 27,\n",
       " 28,\n",
       " 29,\n",
       " 30]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 销售人员\n",
    "sql2 = 'select * from salesstaff;'\n",
    "df_salesstaff = pd.read_sql(sql2,conn)\n",
    "salesstaff_ids = df_salesstaff['id'].values.tolist()  \n",
    "salesstaff_ids"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 遍历销售人员, 每个销售提取25个新客户\n",
    "def get_mission_data1():\n",
    "    '''\n",
    "    [\n",
    "        {\"salesstaff_id\":id,\"customer_id\":id, \"tel\":tel}\n",
    "    ]\n",
    "    '''\n",
    "    data = []\n",
    "    \n",
    "    df_customer_dict = df_customer.to_dict()\n",
    "    \n",
    "    for index,salesstaff_id in enumerate(salesstaff_ids):\n",
    "        \n",
    "        for i in range(index*25, (index+1)*25):\n",
    "            this_customer_id = df_customer_dict['customer_id'][i]\n",
    "            this_tel = df_customer_dict['tel'][i]\n",
    "            \n",
    "            data.append(\n",
    "                {\n",
    "                    'salesstaff_id':salesstaff_id,\n",
    "                    'customer_id':this_customer_id,\n",
    "                    'tel':this_tel\n",
    "                }\n",
    "            )\n",
    "            \n",
    "        break\n",
    "    return data\n",
    "\n",
    "data1 = get_mission_data1()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>customer_id</th>\n",
       "      <th>salesstaff_id</th>\n",
       "      <th>tel</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>539</td>\n",
       "      <td>1</td>\n",
       "      <td>6f7602c534ce83d367b3c53a4f36c0b7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>540</td>\n",
       "      <td>1</td>\n",
       "      <td>d750c7b30e85efceb15f9838548fc085</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>541</td>\n",
       "      <td>1</td>\n",
       "      <td>4fcd26ac2390e3f54d1a72b87ba4c77c</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>542</td>\n",
       "      <td>1</td>\n",
       "      <td>7c134ea8df6ab6e78143eba0a3445e6e</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>543</td>\n",
       "      <td>1</td>\n",
       "      <td>0c883e4a18c193c84e9c4785adb4d847</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   customer_id  salesstaff_id                               tel\n",
       "0          539              1  6f7602c534ce83d367b3c53a4f36c0b7\n",
       "1          540              1  d750c7b30e85efceb15f9838548fc085\n",
       "2          541              1  4fcd26ac2390e3f54d1a72b87ba4c77c\n",
       "3          542              1  7c134ea8df6ab6e78143eba0a3445e6e\n",
       "4          543              1  0c883e4a18c193c84e9c4785adb4d847"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_data1 = pd.DataFrame(data1)\n",
    "df_data1.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2. 接收其他销售人员未签单成功的意向客户"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>customer_id</th>\n",
       "      <th>tel</th>\n",
       "      <th>salesstaff_id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>12231</td>\n",
       "      <td>17810ad73067e8706f5b67f2ec8834fa</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>12231</td>\n",
       "      <td>17810ad73067e8706f5b67f2ec8834fa</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>12231</td>\n",
       "      <td>17810ad73067e8706f5b67f2ec8834fa</td>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>29892</td>\n",
       "      <td>478d1ac970fbdbeaa1eb57d419c35e72</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>17229</td>\n",
       "      <td>486ea018b00323972c871097b9736a26</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   customer_id                               tel  salesstaff_id\n",
       "0        12231  17810ad73067e8706f5b67f2ec8834fa              4\n",
       "1        12231  17810ad73067e8706f5b67f2ec8834fa              8\n",
       "2        12231  17810ad73067e8706f5b67f2ec8834fa             26\n",
       "3        29892  478d1ac970fbdbeaa1eb57d419c35e72              8\n",
       "4        17229  486ea018b00323972c871097b9736a26              8"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 提取已沟通的意向客户及已对该客户跟进过的销售\n",
    "sql3 = 'select mission.customer_id as customer_id, c.tel as tel, mission.salesstaff_id as salesstaff_id from mission inner join customer c on mission.customer_id = c.id where customer_id in (select customer_id from mission where createDate = \"2020-06-29\" and status_id = 1);'\n",
    "df_last_mission = pd.read_sql(\n",
    "    sql3,conn\n",
    ")\n",
    "df_last_mission.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'customer_id': 487,\n",
       "  'salesstaff_id': 20,\n",
       "  'tel': 'a12ddddece31a06b674e41d00c120a35'},\n",
       " {'customer_id': 517,\n",
       "  'salesstaff_id': 8,\n",
       "  'tel': 'ec4424adedf2ec7fc48c3bfeed54ef25'},\n",
       " {'customer_id': 518,\n",
       "  'salesstaff_id': 9,\n",
       "  'tel': '1090f73bb072604a7a7109d0c641306b'},\n",
       " {'customer_id': 521,\n",
       "  'salesstaff_id': 11,\n",
       "  'tel': 'c098a8f2bddc66cc97034adaa78d3f01'},\n",
       " {'customer_id': 1034,\n",
       "  'salesstaff_id': 30,\n",
       "  'tel': '80b0c7a8493a547b37fa691064119606'},\n",
       " {'customer_id': 1037,\n",
       "  'salesstaff_id': 3,\n",
       "  'tel': 'ebcb8da68545f196b27f050ac00d3dad'},\n",
       " {'customer_id': 1040,\n",
       "  'salesstaff_id': 25,\n",
       "  'tel': '23b9216d0a9ae32aaeaa6e7a17f0971f'},\n",
       " {'customer_id': 1061,\n",
       "  'salesstaff_id': 15,\n",
       "  'tel': 'd5ac33230fe75560b8bb886f17edd108'},\n",
       " {'customer_id': 1063,\n",
       "  'salesstaff_id': 5,\n",
       "  'tel': '3e3f86488efea70a761a3b6a539a3af6'},\n",
       " {'customer_id': 1066,\n",
       "  'salesstaff_id': 29,\n",
       "  'tel': '1dc2a72db1fdfe95344a1f4d8faabedb'},\n",
       " {'customer_id': 1067,\n",
       "  'salesstaff_id': 26,\n",
       "  'tel': 'e02bd377c279ce14f4d94baabdf45c99'},\n",
       " {'customer_id': 1783,\n",
       "  'salesstaff_id': 23,\n",
       "  'tel': 'b0c160fd845516b4f5f5572e4c7558fe'},\n",
       " {'customer_id': 1786,\n",
       "  'salesstaff_id': 27,\n",
       "  'tel': '32abfade8cc64824f66f939393d2d0fe'},\n",
       " {'customer_id': 1788,\n",
       "  'salesstaff_id': 7,\n",
       "  'tel': '2354e260860a3d2f9ddb7b664303110c'},\n",
       " {'customer_id': 1830,\n",
       "  'salesstaff_id': 16,\n",
       "  'tel': '764dd63c2a8a6772ac271fcb9b9f6771'},\n",
       " {'customer_id': 1833,\n",
       "  'salesstaff_id': 12,\n",
       "  'tel': '4f7aefeb62679f364086735df817bd48'},\n",
       " {'customer_id': 1839,\n",
       "  'salesstaff_id': 17,\n",
       "  'tel': '2ab4a9b547c96ea1d57a28675c8d6d1d'},\n",
       " {'customer_id': 1841,\n",
       "  'salesstaff_id': 2,\n",
       "  'tel': 'e9fa8e516d4971d7b3dada7a06131791'},\n",
       " {'customer_id': 1847,\n",
       "  'salesstaff_id': 22,\n",
       "  'tel': 'b0bbd0deda80542a95677f2f8805e906'},\n",
       " {'customer_id': 2548,\n",
       "  'salesstaff_id': 4,\n",
       "  'tel': '8e1a7294a39e3beef2da70cc58893c39'},\n",
       " {'customer_id': 2549,\n",
       "  'salesstaff_id': 1,\n",
       "  'tel': 'a29b331a55812a718abd64b00d6d4ad2'},\n",
       " {'customer_id': 2570,\n",
       "  'salesstaff_id': 21,\n",
       "  'tel': '4123d30acf205d751d48a576b42d7a40'},\n",
       " {'customer_id': 2573,\n",
       "  'salesstaff_id': 13,\n",
       "  'tel': '56863e8c1c8d1a48840b9ee6759d1a9a'},\n",
       " {'customer_id': 2574,\n",
       "  'salesstaff_id': 19,\n",
       "  'tel': '066d5a6f8cced27c0791e7987e2cd6bd'},\n",
       " {'customer_id': 2575,\n",
       "  'salesstaff_id': 18,\n",
       "  'tel': '3f442507687fbeb2cf16abba892521ae'},\n",
       " {'customer_id': 2576,\n",
       "  'salesstaff_id': 6,\n",
       "  'tel': 'cdce6c96174ae002a5273b85f49b8907'},\n",
       " {'customer_id': 2800,\n",
       "  'salesstaff_id': 28,\n",
       "  'tel': '86227e434a3b7292842b4a027ccaecd8'},\n",
       " {'customer_id': 3419,\n",
       "  'salesstaff_id': 24,\n",
       "  'tel': 'ad267711387aa5583dc6851b20a2af4f'},\n",
       " {'customer_id': 3429,\n",
       "  'salesstaff_id': 10,\n",
       "  'tel': '0bdfe5dc732dd3802172eebe91aba03c'},\n",
       " {'customer_id': 3434,\n",
       "  'salesstaff_id': 14,\n",
       "  'tel': '1445da6374aa16ac33464b6935498ecb'},\n",
       " {'customer_id': 3435,\n",
       "  'salesstaff_id': 11,\n",
       "  'tel': '1871fca1a8f514a8cd46998f0a396bbc'},\n",
       " {'customer_id': 4012,\n",
       "  'salesstaff_id': 14,\n",
       "  'tel': '49bab982b7d75c98d9eef5ff6877cbc9'},\n",
       " {'customer_id': 4034,\n",
       "  'salesstaff_id': 7,\n",
       "  'tel': '3ebd1e8fc0c519bcf080c0626d99dd90'},\n",
       " {'customer_id': 4035,\n",
       "  'salesstaff_id': 26,\n",
       "  'tel': '0070cad27da4fc2ce2efd9a1fd949d76'},\n",
       " {'customer_id': 4496,\n",
       "  'salesstaff_id': 2,\n",
       "  'tel': 'a5ab0698be8f355b37b7bba85d840fa1'},\n",
       " {'customer_id': 4497,\n",
       "  'salesstaff_id': 17,\n",
       "  'tel': 'c7636ef4ae16f744ed40c766867a2bb8'},\n",
       " {'customer_id': 4498,\n",
       "  'salesstaff_id': 20,\n",
       "  'tel': 'f67a83bf2d3040497c75544914291018'},\n",
       " {'customer_id': 4499,\n",
       "  'salesstaff_id': 6,\n",
       "  'tel': '860b48baff76d94f7470bd33b7dd1e64'},\n",
       " {'customer_id': 4501,\n",
       "  'salesstaff_id': 19,\n",
       "  'tel': '03752935abbfd5c79ee89a0c1a1291cb'},\n",
       " {'customer_id': 4503,\n",
       "  'salesstaff_id': 28,\n",
       "  'tel': 'de3d40c6aaaf76325715bc5188d0c459'},\n",
       " {'customer_id': 4973,\n",
       "  'salesstaff_id': 18,\n",
       "  'tel': '715cd24adf27d9268ca44ea00937bebe'},\n",
       " {'customer_id': 4992,\n",
       "  'salesstaff_id': 4,\n",
       "  'tel': '12dc07619cb60fa57f9f84dcbab6bb37'},\n",
       " {'customer_id': 4994,\n",
       "  'salesstaff_id': 5,\n",
       "  'tel': 'b29fab2518fa0d24ca5975b275120cf3'},\n",
       " {'customer_id': 4998,\n",
       "  'salesstaff_id': 21,\n",
       "  'tel': '8e65e1028c386b85a72e362f42f1a159'},\n",
       " {'customer_id': 5002,\n",
       "  'salesstaff_id': 22,\n",
       "  'tel': '8b0957ebb91e2c8c892889e1fc043b07'},\n",
       " {'customer_id': 5004,\n",
       "  'salesstaff_id': 12,\n",
       "  'tel': '39aa0e1097ad2ba42fedbfc769158fc7'},\n",
       " {'customer_id': 5272,\n",
       "  'salesstaff_id': 8,\n",
       "  'tel': 'a58d29bec8f6279205c62cefb24ab884'},\n",
       " {'customer_id': 5273,\n",
       "  'salesstaff_id': 15,\n",
       "  'tel': '8c02cc367639b2b90957a83c063e6e15'},\n",
       " {'customer_id': 5277,\n",
       "  'salesstaff_id': 9,\n",
       "  'tel': '9e1332e21660d2a1995d1f96360ebfe2'},\n",
       " {'customer_id': 5278,\n",
       "  'salesstaff_id': 27,\n",
       "  'tel': '940701495a6b43a7cb0f96b40d0e987f'},\n",
       " {'customer_id': 5770,\n",
       "  'salesstaff_id': 3,\n",
       "  'tel': '9fa3b86da5845c9f925124e27c59840a'},\n",
       " {'customer_id': 5799,\n",
       "  'salesstaff_id': 13,\n",
       "  'tel': '48621af9e861f2ea7f9859fcd27f154d'},\n",
       " {'customer_id': 5801,\n",
       "  'salesstaff_id': 10,\n",
       "  'tel': '14380452e2cdb0b654f8c2709dd347f9'},\n",
       " {'customer_id': 5806,\n",
       "  'salesstaff_id': 29,\n",
       "  'tel': '30583f3836882c67e21ef78282775e77'},\n",
       " {'customer_id': 5809,\n",
       "  'salesstaff_id': 16,\n",
       "  'tel': 'b13239fa274f055638d47a6f843cf8cc'},\n",
       " {'customer_id': 5810,\n",
       "  'salesstaff_id': 1,\n",
       "  'tel': '28ca6179281012afce47ef830b3b432d'},\n",
       " {'customer_id': 5811,\n",
       "  'salesstaff_id': 30,\n",
       "  'tel': '994869a26d564f3405a51819eaf16a55'},\n",
       " {'customer_id': 5812,\n",
       "  'salesstaff_id': 25,\n",
       "  'tel': '2ded3d7ad792cb98ee95e4b5d9005f71'},\n",
       " {'customer_id': 6637,\n",
       "  'salesstaff_id': 23,\n",
       "  'tel': 'a721b7b220d7e355cd789bfff0549e3f'},\n",
       " {'customer_id': 6640,\n",
       "  'salesstaff_id': 24,\n",
       "  'tel': '7220abae598124af754e6cb197b475a5'},\n",
       " {'customer_id': 6667,\n",
       "  'salesstaff_id': 29,\n",
       "  'tel': '9bee6af89038cf2f6991bf2c31fa0b76'},\n",
       " {'customer_id': 6668,\n",
       "  'salesstaff_id': 26,\n",
       "  'tel': '64367221e5adfe66004a58c363dda1a6'},\n",
       " {'customer_id': 6669,\n",
       "  'salesstaff_id': 15,\n",
       "  'tel': '5a2279c8cad5631d533d373bcbefa635'},\n",
       " {'customer_id': 6670,\n",
       "  'salesstaff_id': 10,\n",
       "  'tel': '8c635c79db92f04be6b48cac735aadea'},\n",
       " {'customer_id': 6671,\n",
       "  'salesstaff_id': 18,\n",
       "  'tel': '115b1d9c786ddb1131c954b4537a55d6'},\n",
       " {'customer_id': 6677,\n",
       "  'salesstaff_id': 14,\n",
       "  'tel': '3c4a408675d6a63c9703feb2c136b4ce'},\n",
       " {'customer_id': 6679,\n",
       "  'salesstaff_id': 9,\n",
       "  'tel': '595038919380bdcb1c66dea2e7644150'},\n",
       " {'customer_id': 6680,\n",
       "  'salesstaff_id': 8,\n",
       "  'tel': '9697064688b9659b3bb64ae5f8f81f47'},\n",
       " {'customer_id': 6681,\n",
       "  'salesstaff_id': 5,\n",
       "  'tel': '8dccf301ba3f85512b6eede371c2fd6e'},\n",
       " {'customer_id': 6682,\n",
       "  'salesstaff_id': 4,\n",
       "  'tel': '78c517606938cd6d9fb3b2fac80be4d2'},\n",
       " {'customer_id': 6687,\n",
       "  'salesstaff_id': 25,\n",
       "  'tel': 'bca3c2b7bd042c474fdab1e54e6b101a'},\n",
       " {'customer_id': 6689,\n",
       "  'salesstaff_id': 30,\n",
       "  'tel': '1b478439a0a58894f1101c1edbcffa64'},\n",
       " {'customer_id': 6690,\n",
       "  'salesstaff_id': 28,\n",
       "  'tel': '5a850afb33ccdd2fe3b5530b88d5cfc2'},\n",
       " {'customer_id': 6692,\n",
       "  'salesstaff_id': 13,\n",
       "  'tel': '6fba0fe155e4c7469c68b007d1f402f9'},\n",
       " {'customer_id': 7210,\n",
       "  'salesstaff_id': 1,\n",
       "  'tel': '906b76d50a3fac5584c5e666630fcf93'},\n",
       " {'customer_id': 7239,\n",
       "  'salesstaff_id': 11,\n",
       "  'tel': '73f7841e7cb1e29c55c6612706706d10'},\n",
       " {'customer_id': 7240,\n",
       "  'salesstaff_id': 12,\n",
       "  'tel': '7b4e3b630ced472de40f6e9758745342'},\n",
       " {'customer_id': 7246,\n",
       "  'salesstaff_id': 20,\n",
       "  'tel': '927d392621ff90f03277071327fbb60f'},\n",
       " {'customer_id': 8031,\n",
       "  'salesstaff_id': 6,\n",
       "  'tel': 'bd3df39fdc0ca7b91de5b6c3382753ce'},\n",
       " {'customer_id': 8037,\n",
       "  'salesstaff_id': 17,\n",
       "  'tel': '9569b787c5f00f92f1040ef22c43144f'},\n",
       " {'customer_id': 8058,\n",
       "  'salesstaff_id': 2,\n",
       "  'tel': '9d2fc6a44da81afb74a75ea9ede52d27'},\n",
       " {'customer_id': 8063,\n",
       "  'salesstaff_id': 27,\n",
       "  'tel': '452e1dadf9f050bd7b4a354131f7865e'},\n",
       " {'customer_id': 8064,\n",
       "  'salesstaff_id': 16,\n",
       "  'tel': 'b31f6aaad8ad93aa7ff2e48673bbef16'},\n",
       " {'customer_id': 8070,\n",
       "  'salesstaff_id': 23,\n",
       "  'tel': '1bc6a972c05df4d9c558e4c6e95bdd48'},\n",
       " {'customer_id': 8071,\n",
       "  'salesstaff_id': 22,\n",
       "  'tel': 'cd0938d63d57394c6aa2ee4d78ec1482'},\n",
       " {'customer_id': 8076,\n",
       "  'salesstaff_id': 7,\n",
       "  'tel': '5bc559db2752c29572f635a3c29bd215'},\n",
       " {'customer_id': 8077,\n",
       "  'salesstaff_id': 3,\n",
       "  'tel': '7b949d2434f99ec2c508708545aee19a'},\n",
       " {'customer_id': 8565,\n",
       "  'salesstaff_id': 24,\n",
       "  'tel': '69801afdd1ccbd469ff4da3c60b7fac8'},\n",
       " {'customer_id': 8567,\n",
       "  'salesstaff_id': 19,\n",
       "  'tel': '37d4672fb075fb6cfd6a3baa31973cd2'},\n",
       " {'customer_id': 8569,\n",
       "  'salesstaff_id': 21,\n",
       "  'tel': '735c5b3606d848977e4abe5c0fa89486'},\n",
       " {'customer_id': 8570,\n",
       "  'salesstaff_id': 29,\n",
       "  'tel': '9c384c20d790f044c95352dca0ddfd09'},\n",
       " {'customer_id': 9129,\n",
       "  'salesstaff_id': 8,\n",
       "  'tel': '3ec078b9beb80574311af95c41fbfbc4'},\n",
       " {'customer_id': 9135,\n",
       "  'salesstaff_id': 25,\n",
       "  'tel': 'b531819ac8b3673ec2bc3fc8263e603a'},\n",
       " {'customer_id': 9165,\n",
       "  'salesstaff_id': 2,\n",
       "  'tel': '9cc9e34180ea3ad12298a267b9a1046b'},\n",
       " {'customer_id': 9685,\n",
       "  'salesstaff_id': 1,\n",
       "  'tel': 'b6b746bf6b6176ca9792eacc5675e6f8'},\n",
       " {'customer_id': 9688,\n",
       "  'salesstaff_id': 15,\n",
       "  'tel': '6ad743114c0584e3d86f1b46bb06b557'},\n",
       " {'customer_id': 9714,\n",
       "  'salesstaff_id': 22,\n",
       "  'tel': '41261628b234476f1552c5e622b0c77e'},\n",
       " {'customer_id': 9721,\n",
       "  'salesstaff_id': 10,\n",
       "  'tel': '2ad65c6dcd274573c3bd9c213d892920'},\n",
       " {'customer_id': 10535,\n",
       "  'salesstaff_id': 23,\n",
       "  'tel': 'bd464abde43fdfa9e018394dfdc43952'},\n",
       " {'customer_id': 10542,\n",
       "  'salesstaff_id': 20,\n",
       "  'tel': 'e10a7de3f5fae55a297c7d2b1a72baa9'},\n",
       " {'customer_id': 10544,\n",
       "  'salesstaff_id': 4,\n",
       "  'tel': '51b9ba4f57f102bfbe700790ced309f5'},\n",
       " {'customer_id': 10574,\n",
       "  'salesstaff_id': 9,\n",
       "  'tel': 'dec4aa8f2257a74e58451d15f4feb570'},\n",
       " {'customer_id': 10576,\n",
       "  'salesstaff_id': 30,\n",
       "  'tel': 'b6f6487e434f57a160ebe1a5b60f654e'},\n",
       " {'customer_id': 10579,\n",
       "  'salesstaff_id': 26,\n",
       "  'tel': 'ad6d0107a3578e598b4f3578dcf69c94'},\n",
       " {'customer_id': 10583,\n",
       "  'salesstaff_id': 7,\n",
       "  'tel': 'bc87284113c21f90dba425a1c66d1262'},\n",
       " {'customer_id': 10584,\n",
       "  'salesstaff_id': 16,\n",
       "  'tel': '8bf2378c61cf913da786c9b3cac98d72'},\n",
       " {'customer_id': 10585,\n",
       "  'salesstaff_id': 14,\n",
       "  'tel': 'c3833a2a88cb2c1718d1daa285d6034e'},\n",
       " {'customer_id': 10586,\n",
       "  'salesstaff_id': 3,\n",
       "  'tel': '67c035ac883deabd0e03c13465508264'},\n",
       " {'customer_id': 10587,\n",
       "  'salesstaff_id': 17,\n",
       "  'tel': '9d8b8c3beb6f2fd97dc5bc16ea826902'},\n",
       " {'customer_id': 10591,\n",
       "  'salesstaff_id': 27,\n",
       "  'tel': '8eb46e7028b022f730e8dcdbce0156c2'},\n",
       " {'customer_id': 10594,\n",
       "  'salesstaff_id': 19,\n",
       "  'tel': '2268c62a4c96346efcfd56e2054e8568'},\n",
       " {'customer_id': 10595,\n",
       "  'salesstaff_id': 6,\n",
       "  'tel': '3d828de9db3e1f87dcece745547535a7'},\n",
       " {'customer_id': 11439,\n",
       "  'salesstaff_id': 21,\n",
       "  'tel': 'b02bea54394f69cdc6dc6ab601fc9fe6'},\n",
       " {'customer_id': 11445,\n",
       "  'salesstaff_id': 28,\n",
       "  'tel': '64f9231d710bd78908bcb04e364c4b15'},\n",
       " {'customer_id': 11449,\n",
       "  'salesstaff_id': 13,\n",
       "  'tel': 'ebb403688613e4e67e126b06de06e97b'},\n",
       " {'customer_id': 11456,\n",
       "  'salesstaff_id': 5,\n",
       "  'tel': '36a942068b09131f4ebe5b77cdd22802'},\n",
       " {'customer_id': 11458,\n",
       "  'salesstaff_id': 18,\n",
       "  'tel': '9c31ae749e1ba740064e6b4ea45b12f7'},\n",
       " {'customer_id': 11459,\n",
       "  'salesstaff_id': 12,\n",
       "  'tel': 'dd0d1c93c8a05fc65f0bab0ed24334a9'},\n",
       " {'customer_id': 11481,\n",
       "  'salesstaff_id': 24,\n",
       "  'tel': 'e707eedd96afbec5508e4724f247d60e'},\n",
       " {'customer_id': 11482,\n",
       "  'salesstaff_id': 11,\n",
       "  'tel': '17521c4da23e99a045b4395263df5cb9'},\n",
       " {'customer_id': 11485,\n",
       "  'salesstaff_id': 2,\n",
       "  'tel': '72fd1538959ac8fe7cd65ff45a119b50'},\n",
       " {'customer_id': 11486,\n",
       "  'salesstaff_id': 16,\n",
       "  'tel': 'eefd8ff7264a7219447f795be187fae4'},\n",
       " {'customer_id': 11487,\n",
       "  'salesstaff_id': 19,\n",
       "  'tel': '405488a9769db1a178fa2e26ec10ea19'},\n",
       " {'customer_id': 11488,\n",
       "  'salesstaff_id': 27,\n",
       "  'tel': '5a8ec1ab94b9b2ede693fc3fd9f50564'},\n",
       " {'customer_id': 12231,\n",
       "  'salesstaff_id': 5,\n",
       "  'tel': '17810ad73067e8706f5b67f2ec8834fa'},\n",
       " {'customer_id': 12268,\n",
       "  'salesstaff_id': 23,\n",
       "  'tel': '75ab5606dad2db5e1850c937fb3bf859'},\n",
       " {'customer_id': 12277,\n",
       "  'salesstaff_id': 14,\n",
       "  'tel': '8f317785cd609fd68dbca7132b7876a1'},\n",
       " {'customer_id': 12282,\n",
       "  'salesstaff_id': 17,\n",
       "  'tel': '6d93f386a07af8af03f62d2b9b0d56c1'},\n",
       " {'customer_id': 12283,\n",
       "  'salesstaff_id': 12,\n",
       "  'tel': '714a56ff2b9c91688e99b76f27d83ef0'},\n",
       " {'customer_id': 12289,\n",
       "  'salesstaff_id': 29,\n",
       "  'tel': 'e93e2bb6673a4be7e735c218795d2af9'},\n",
       " {'customer_id': 12792,\n",
       "  'salesstaff_id': 22,\n",
       "  'tel': '330bbe6c1b84ed1d08b4941a4b122a1b'},\n",
       " {'customer_id': 12815,\n",
       "  'salesstaff_id': 20,\n",
       "  'tel': 'ea7804c27f01c34e719308440e3c8018'},\n",
       " {'customer_id': 12820,\n",
       "  'salesstaff_id': 13,\n",
       "  'tel': 'ecad33821ededdd68a12058f65f281f1'},\n",
       " {'customer_id': 12823,\n",
       "  'salesstaff_id': 9,\n",
       "  'tel': '9bd44152af39ce4a2163b40366602bdc'},\n",
       " {'customer_id': 12825,\n",
       "  'salesstaff_id': 10,\n",
       "  'tel': 'f2e1381f2c9a714303ffe66300e5eb90'},\n",
       " {'customer_id': 13335,\n",
       "  'salesstaff_id': 11,\n",
       "  'tel': '24827eb242fb763a0d5ad966feb22439'},\n",
       " {'customer_id': 13363,\n",
       "  'salesstaff_id': 1,\n",
       "  'tel': '381fc0a48e96d340d79a729f6d7311db'},\n",
       " {'customer_id': 13366,\n",
       "  'salesstaff_id': 8,\n",
       "  'tel': '1e99d148c4cd54895f4755eb4088e0dc'},\n",
       " {'customer_id': 13367,\n",
       "  'salesstaff_id': 24,\n",
       "  'tel': 'f708339f9cd9f1a4e5744a1715d8602c'},\n",
       " {'customer_id': 13368,\n",
       "  'salesstaff_id': 6,\n",
       "  'tel': 'a933e24663343caef1a4483805bf04e0'},\n",
       " {'customer_id': 13370,\n",
       "  'salesstaff_id': 4,\n",
       "  'tel': '6245267d25889cc04997003f465b8152'},\n",
       " {'customer_id': 13371,\n",
       "  'salesstaff_id': 25,\n",
       "  'tel': '563ac0dba5e17ec6909bd697d523270a'},\n",
       " {'customer_id': 13722,\n",
       "  'salesstaff_id': 21,\n",
       "  'tel': '9607ced0d9f4bc7a2975f710da510474'},\n",
       " {'customer_id': 13730,\n",
       "  'salesstaff_id': 3,\n",
       "  'tel': '45f873d3ac44aeefba7a5d896aefbf05'},\n",
       " {'customer_id': 13731,\n",
       "  'salesstaff_id': 18,\n",
       "  'tel': '1b9a0fe76b3cb4b8b392ec5e3ce6e4de'},\n",
       " {'customer_id': 13733,\n",
       "  'salesstaff_id': 30,\n",
       "  'tel': 'a9dd99caa009436f67898f4254cb6d0e'},\n",
       " {'customer_id': 13735,\n",
       "  'salesstaff_id': 26,\n",
       "  'tel': '5e2ea76f2e8c8f40e53c3b5e9c103917'},\n",
       " {'customer_id': 13739,\n",
       "  'salesstaff_id': 28,\n",
       "  'tel': '80ab74021aad0a2fafed542255da4207'},\n",
       " {'customer_id': 14472,\n",
       "  'salesstaff_id': 15,\n",
       "  'tel': 'f0efa5a9fc22a8e053a280084e6331b8'},\n",
       " {'customer_id': 14482,\n",
       "  'salesstaff_id': 8,\n",
       "  'tel': 'fa981dd239e90dc35a5b8469583581ba'},\n",
       " {'customer_id': 14490,\n",
       "  'salesstaff_id': 16,\n",
       "  'tel': 'b739a576009715f58ffe71e8ee9bb45a'},\n",
       " {'customer_id': 14492,\n",
       "  'salesstaff_id': 23,\n",
       "  'tel': 'd9fca3c96cbdd1337f20188c84c7b8dd'},\n",
       " {'customer_id': 14535,\n",
       "  'salesstaff_id': 6,\n",
       "  'tel': 'b0b68daf179d7374cb5d782ffa6c6eec'},\n",
       " {'customer_id': 14537,\n",
       "  'salesstaff_id': 13,\n",
       "  'tel': 'a8d38bd14a5001db6dedb57aad1d0db1'},\n",
       " {'customer_id': 14538,\n",
       "  'salesstaff_id': 27,\n",
       "  'tel': '2840f6cbffc45f901a9010cb6efc8f77'},\n",
       " {'customer_id': 14540,\n",
       "  'salesstaff_id': 18,\n",
       "  'tel': '74d8d0e8219d596152f83647ad93ae84'},\n",
       " {'customer_id': 14542,\n",
       "  'salesstaff_id': 12,\n",
       "  'tel': 'da585aa51762807c7aa115de2c07c708'},\n",
       " {'customer_id': 15408,\n",
       "  'salesstaff_id': 3,\n",
       "  'tel': '4b6b746f1128cc6b145034c6e1c5ccef'},\n",
       " {'customer_id': 15410,\n",
       "  'salesstaff_id': 24,\n",
       "  'tel': '82c0f41730805c95abbe9d4618c00f09'},\n",
       " {'customer_id': 15414,\n",
       "  'salesstaff_id': 22,\n",
       "  'tel': 'bd689f7ee245713a5967dea59876d734'},\n",
       " {'customer_id': 15450,\n",
       "  'salesstaff_id': 11,\n",
       "  'tel': '17402a8372077b1668a7949b66ce04b6'},\n",
       " {'customer_id': 15451,\n",
       "  'salesstaff_id': 29,\n",
       "  'tel': '441ee8f26d5d4387f750431b261c4cf7'},\n",
       " {'customer_id': 15452,\n",
       "  'salesstaff_id': 7,\n",
       "  'tel': '3bd94a8cbbfbfb413ffe1a70ffca2b32'},\n",
       " {'customer_id': 15458,\n",
       "  'salesstaff_id': 28,\n",
       "  'tel': 'cbb5ff25f251eba78b71cccd99283522'},\n",
       " {'customer_id': 15459,\n",
       "  'salesstaff_id': 25,\n",
       "  'tel': 'fe05fe7958d4111880981127e418b52a'},\n",
       " {'customer_id': 15464,\n",
       "  'salesstaff_id': 21,\n",
       "  'tel': 'd1a315efb1546ee00737d26877022dd6'},\n",
       " {'customer_id': 15465,\n",
       "  'salesstaff_id': 2,\n",
       "  'tel': '1f30c83d02c407fa330b2eb0e80d86ce'},\n",
       " {'customer_id': 15467,\n",
       "  'salesstaff_id': 14,\n",
       "  'tel': '4ada5c3caf15780f2b50d7853e979cf8'},\n",
       " {'customer_id': 15469,\n",
       "  'salesstaff_id': 5,\n",
       "  'tel': 'a37dd64f8e47723672f83158efbbe3fd'},\n",
       " {'customer_id': 15474,\n",
       "  'salesstaff_id': 4,\n",
       "  'tel': '3fbdae11a5b4840748d622eee0d508c2'},\n",
       " {'customer_id': 16301,\n",
       "  'salesstaff_id': 19,\n",
       "  'tel': '82d0bd71c6dbd4a1005405c6e9eb6a0d'},\n",
       " {'customer_id': 16327,\n",
       "  'salesstaff_id': 1,\n",
       "  'tel': '4221a76a8222ea4ad0f0836e2e61036f'},\n",
       " {'customer_id': 16334,\n",
       "  'salesstaff_id': 15,\n",
       "  'tel': '9093efe171f45923b8e771fc9567851c'},\n",
       " {'customer_id': 16336,\n",
       "  'salesstaff_id': 30,\n",
       "  'tel': '1e09b5dd875a162ba35a102e77018d08'},\n",
       " {'customer_id': 16337,\n",
       "  'salesstaff_id': 17,\n",
       "  'tel': '50aa397aee1ce7f840a6b415fae735d9'},\n",
       " {'customer_id': 16338,\n",
       "  'salesstaff_id': 9,\n",
       "  'tel': 'e5184d4f18488524498601c45c03b491'},\n",
       " {'customer_id': 16341,\n",
       "  'salesstaff_id': 26,\n",
       "  'tel': '8b60d308badb101a34dc47addbf084e0'},\n",
       " {'customer_id': 16345,\n",
       "  'salesstaff_id': 10,\n",
       "  'tel': 'f0cbbdaf20cf88199ad4a98871bf8414'},\n",
       " {'customer_id': 16346,\n",
       "  'salesstaff_id': 20,\n",
       "  'tel': 'b0f0c93b48c99eb23e9c52e26ee1f621'},\n",
       " {'customer_id': 16352,\n",
       "  'salesstaff_id': 29,\n",
       "  'tel': 'd5e1ce53e6bcdb1c603ce73cfb1b6cd2'},\n",
       " {'customer_id': 17198,\n",
       "  'salesstaff_id': 2,\n",
       "  'tel': 'f0e07137e7ce5a104042b5ec4d54524b'},\n",
       " {'customer_id': 17228,\n",
       "  'salesstaff_id': 19,\n",
       "  'tel': '0b50f337f126170fafdebd42b7d9570d'},\n",
       " {'customer_id': 17229,\n",
       "  'salesstaff_id': 13,\n",
       "  'tel': '486ea018b00323972c871097b9736a26'},\n",
       " {'customer_id': 17234,\n",
       "  'salesstaff_id': 1,\n",
       "  'tel': 'f952464b3a3c81f3f230da4e4855c182'},\n",
       " {'customer_id': 17238,\n",
       "  'salesstaff_id': 21,\n",
       "  'tel': '7c38d1bab230a1e88de53991a851c878'},\n",
       " {'customer_id': 17239,\n",
       "  'salesstaff_id': 10,\n",
       "  'tel': '686ee1e2aa874fa392caba9730fbdda6'},\n",
       " {'customer_id': 17697,\n",
       "  'salesstaff_id': 12,\n",
       "  'tel': 'ae6a95423343863a1d3abf9143076194'},\n",
       " {'customer_id': 17704,\n",
       "  'salesstaff_id': 27,\n",
       "  'tel': 'bc0e643a1d3d8d5cd1d9f2979bfe7244'},\n",
       " {'customer_id': 17723,\n",
       "  'salesstaff_id': 6,\n",
       "  'tel': 'c965674cfd8eeebbd38326fe199fff27'},\n",
       " {'customer_id': 18099,\n",
       "  'salesstaff_id': 8,\n",
       "  'tel': '18c12dbedb0c82856c5efb089658b3bf'},\n",
       " {'customer_id': 18100,\n",
       "  'salesstaff_id': 25,\n",
       "  'tel': 'ffa05f7e6fc52badb03fece24f4e47b5'},\n",
       " {'customer_id': 18101,\n",
       "  'salesstaff_id': 5,\n",
       "  'tel': '6e5975b5ff37963defca9cfc4f1c481a'},\n",
       " {'customer_id': 18102,\n",
       "  'salesstaff_id': 23,\n",
       "  'tel': 'c3bcee379117b75c8865430506d43928'},\n",
       " {'customer_id': 18810,\n",
       "  'salesstaff_id': 4,\n",
       "  'tel': '7015cd11459e9e5e6d41171a7b58193f'},\n",
       " {'customer_id': 18811,\n",
       "  'salesstaff_id': 26,\n",
       "  'tel': '68780dc4dad4301966d2bbf57215dbe8'},\n",
       " {'customer_id': 18812,\n",
       "  'salesstaff_id': 7,\n",
       "  'tel': 'e9774deba5172a7b74eaaad8a5c243fa'},\n",
       " {'customer_id': 18822,\n",
       "  'salesstaff_id': 18,\n",
       "  'tel': 'ab74359ce1712ce0fd8dfb8707092838'},\n",
       " {'customer_id': 18823,\n",
       "  'salesstaff_id': 17,\n",
       "  'tel': 'ab66e97e59f9887d33b3b819dbba522f'},\n",
       " {'customer_id': 18846,\n",
       "  'salesstaff_id': 14,\n",
       "  'tel': '400ea68033a882063c5410c418ef455b'},\n",
       " {'customer_id': 18847,\n",
       "  'salesstaff_id': 22,\n",
       "  'tel': 'c1fffd0ea50972887dcf39f01c775808'},\n",
       " {'customer_id': 18853,\n",
       "  'salesstaff_id': 9,\n",
       "  'tel': 'fc50b3727293ee25bfa8f34c2a85bc29'},\n",
       " {'customer_id': 18855,\n",
       "  'salesstaff_id': 20,\n",
       "  'tel': 'e4ab97427ad5b6ea2fbf81a915614b3d'},\n",
       " {'customer_id': 18856,\n",
       "  'salesstaff_id': 24,\n",
       "  'tel': 'e58bee095c919442aca145776616bad5'},\n",
       " {'customer_id': 18858,\n",
       "  'salesstaff_id': 30,\n",
       "  'tel': '2c667ff4f4d6283810c9f407349e4d8a'},\n",
       " {'customer_id': 18862,\n",
       "  'salesstaff_id': 16,\n",
       "  'tel': '15412ad93384f50ae5529ef3dcb8de3f'},\n",
       " {'customer_id': 18867,\n",
       "  'salesstaff_id': 15,\n",
       "  'tel': 'd33d8cdaf8c96eaa26ea5faeedcd8886'},\n",
       " {'customer_id': 18868,\n",
       "  'salesstaff_id': 3,\n",
       "  'tel': '8a7d4680c7a71e8c01314763e264eb0b'},\n",
       " {'customer_id': 18871,\n",
       "  'salesstaff_id': 11,\n",
       "  'tel': 'e79b4191f7e35fa4a3d032224630912e'},\n",
       " {'customer_id': 19709,\n",
       "  'salesstaff_id': 28,\n",
       "  'tel': '02e70a97287e61d4aedba4f98dbb9e17'},\n",
       " {'customer_id': 19742,\n",
       "  'salesstaff_id': 20,\n",
       "  'tel': '9cd33bb405cb4fe8eff5579e08f3047b'},\n",
       " {'customer_id': 19743,\n",
       "  'salesstaff_id': 12,\n",
       "  'tel': '142b9fed84cf8e2136c8a5247829a233'},\n",
       " {'customer_id': 19747,\n",
       "  'salesstaff_id': 11,\n",
       "  'tel': '72c341d55fc0372158cabf9d89219509'},\n",
       " {'customer_id': 19749,\n",
       "  'salesstaff_id': 2,\n",
       "  'tel': 'aacdca534f513e0912868c41bf271169'},\n",
       " {'customer_id': 19751,\n",
       "  'salesstaff_id': 24,\n",
       "  'tel': 'fa6f2613ad2ca66725f4a0d436aa8de9'},\n",
       " {'customer_id': 19753,\n",
       "  'salesstaff_id': 13,\n",
       "  'tel': '37af72d866927ce119e14e364dff4dd6'},\n",
       " {'customer_id': 20042,\n",
       "  'salesstaff_id': 28,\n",
       "  'tel': '298bd8737babbd33e00a531c618818c0'},\n",
       " {'customer_id': 20051,\n",
       "  'salesstaff_id': 14,\n",
       "  'tel': '4d8326e337b7e105bf75bc1e5af4dbff'},\n",
       " {'customer_id': 20055,\n",
       "  'salesstaff_id': 17,\n",
       "  'tel': 'ac1e0d2418b9374ab4fb06a8cf62d686'},\n",
       " {'customer_id': 20741,\n",
       "  'salesstaff_id': 7,\n",
       "  'tel': '004063edc12a8d87cf189c89d5da0891'},\n",
       " {'customer_id': 20766,\n",
       "  'salesstaff_id': 22,\n",
       "  'tel': 'f1a604a7063bc59bafd53074116ac901'},\n",
       " {'customer_id': 20767,\n",
       "  'salesstaff_id': 30,\n",
       "  'tel': 'cbd20a15b6f86fcf30f924ab109966e4'},\n",
       " {'customer_id': 20775,\n",
       "  'salesstaff_id': 25,\n",
       "  'tel': 'ce79cc6eb2196c2b8658682d1b439d01'},\n",
       " {'customer_id': 20784,\n",
       "  'salesstaff_id': 16,\n",
       "  'tel': '7faeff51e96ef5a552a2684cb92daf1a'},\n",
       " {'customer_id': 20785,\n",
       "  'salesstaff_id': 18,\n",
       "  'tel': '99b48d071f43760ab7d04ec48ae5e3b6'},\n",
       " {'customer_id': 21030,\n",
       "  'salesstaff_id': 19,\n",
       "  'tel': '418b1d09b28d5fc7ed71642fa3297d16'},\n",
       " {'customer_id': 21031,\n",
       "  'salesstaff_id': 1,\n",
       "  'tel': '980d8a315463e88259edf68f108b3750'},\n",
       " {'customer_id': 21629,\n",
       "  'salesstaff_id': 10,\n",
       "  'tel': '859d6455aa52e73d5f7a96e5e1c298d5'},\n",
       " {'customer_id': 21632,\n",
       "  'salesstaff_id': 26,\n",
       "  'tel': 'c30ded1946b5fd759649d58cf80fdd77'},\n",
       " {'customer_id': 21663,\n",
       "  'salesstaff_id': 3,\n",
       "  'tel': 'e90b95fffb0b3edac24413955d23b7aa'},\n",
       " {'customer_id': 21666,\n",
       "  'salesstaff_id': 15,\n",
       "  'tel': 'd61fcffedccf8375e435ecf274c095cb'},\n",
       " {'customer_id': 21668,\n",
       "  'salesstaff_id': 4,\n",
       "  'tel': 'dd8f5724c33c9c2faa56b0a9fd06b554'},\n",
       " {'customer_id': 21669,\n",
       "  'salesstaff_id': 5,\n",
       "  'tel': '9b9e199c5c397bcbdf683f62d58f4561'},\n",
       " {'customer_id': 21670,\n",
       "  'salesstaff_id': 29,\n",
       "  'tel': '2805d24bb35572c313bb0448db1a8ccb'},\n",
       " {'customer_id': 21672,\n",
       "  'salesstaff_id': 6,\n",
       "  'tel': '3346cc9c27714b5485153a7e7a1379f4'},\n",
       " {'customer_id': 22116,\n",
       "  'salesstaff_id': 27,\n",
       "  'tel': '45c9b4cc669ca6c837d2d3a331b460a0'},\n",
       " {'customer_id': 22138,\n",
       "  'salesstaff_id': 23,\n",
       "  'tel': 'a13434919d4ca041f1ad2c9c4cdf794e'},\n",
       " {'customer_id': 22858,\n",
       "  'salesstaff_id': 9,\n",
       "  'tel': 'b97e386a7cf0f4b04c44bdd7f7c1f10b'},\n",
       " {'customer_id': 22861,\n",
       "  'salesstaff_id': 21,\n",
       "  'tel': 'a8d220c6cc33fbce56b48870666e96ee'},\n",
       " {'customer_id': 22863,\n",
       "  'salesstaff_id': 8,\n",
       "  'tel': 'd04b9390a8676babead7343614a1dc7c'},\n",
       " {'customer_id': 22864,\n",
       "  'salesstaff_id': 8,\n",
       "  'tel': 'af900b59116dc3190d33b6bbcdfa0a8a'},\n",
       " {'customer_id': 22899,\n",
       "  'salesstaff_id': 26,\n",
       "  'tel': '134d712558f1fe0a48c600c039b4e4e6'},\n",
       " {'customer_id': 22903,\n",
       "  'salesstaff_id': 10,\n",
       "  'tel': 'ffdda1ac13c92ee167cff92fe69f06bc'},\n",
       " {'customer_id': 22904,\n",
       "  'salesstaff_id': 9,\n",
       "  'tel': 'cccf680bdf77caeb5cf90ab8b5e6f3fb'},\n",
       " {'customer_id': 22908,\n",
       "  'salesstaff_id': 21,\n",
       "  'tel': '0baea7a0fd95d0f8474bc862056170a0'},\n",
       " {'customer_id': 22913,\n",
       "  'salesstaff_id': 14,\n",
       "  'tel': '18f7de333e4bf4826a691d9bc15ab74d'},\n",
       " {'customer_id': 22916,\n",
       "  'salesstaff_id': 24,\n",
       "  'tel': '44cbc46a20c9388eb7c5a4a4f6a4a8df'},\n",
       " {'customer_id': 22917,\n",
       "  'salesstaff_id': 23,\n",
       "  'tel': '6420d1039f17de0c9e080d9a214a83ab'},\n",
       " {'customer_id': 22919,\n",
       "  'salesstaff_id': 3,\n",
       "  'tel': 'dd50c66136f09c6f71a1339e68149624'},\n",
       " {'customer_id': 23837,\n",
       "  'salesstaff_id': 12,\n",
       "  'tel': '0ac238c0162649b78d35dfc08fcae309'},\n",
       " {'customer_id': 23841,\n",
       "  'salesstaff_id': 20,\n",
       "  'tel': 'dc45e6a78a697d45d5fd2cddcaaccc27'},\n",
       " {'customer_id': 23850,\n",
       "  'salesstaff_id': 4,\n",
       "  'tel': '01532afa1d63e8975a244c7259307aaf'},\n",
       " {'customer_id': 23851,\n",
       "  'salesstaff_id': 13,\n",
       "  'tel': '5bb41335c5053bb5c47ce76d27dbf7b4'},\n",
       " {'customer_id': 23855,\n",
       "  'salesstaff_id': 1,\n",
       "  'tel': '7724a1e3cbd18602d7d7e64ed410bbd2'},\n",
       " {'customer_id': 23892,\n",
       "  'salesstaff_id': 25,\n",
       "  'tel': '6d3927d21297a77f1426ef179b234504'},\n",
       " {'customer_id': 23895,\n",
       "  'salesstaff_id': 6,\n",
       "  'tel': 'b7460d3a99b85c7fa75c9a19ac1872bb'},\n",
       " {'customer_id': 23898,\n",
       "  'salesstaff_id': 16,\n",
       "  'tel': '772cfe9ae0f409c60c77e487666a3f32'},\n",
       " {'customer_id': 23903,\n",
       "  'salesstaff_id': 29,\n",
       "  'tel': 'ef453a38917951ebba1892d3fce3e966'},\n",
       " {'customer_id': 23904,\n",
       "  'salesstaff_id': 28,\n",
       "  'tel': '5cbecce8affc14328c7f1b9e11216722'},\n",
       " {'customer_id': 23906,\n",
       "  'salesstaff_id': 22,\n",
       "  'tel': '50b15bc598061032cd97d33ea690a269'},\n",
       " {'customer_id': 23911,\n",
       "  'salesstaff_id': 5,\n",
       "  'tel': 'baec78b59528a212ec7c6019be7f15dd'},\n",
       " {'customer_id': 24783,\n",
       "  'salesstaff_id': 11,\n",
       "  'tel': 'aadb25290c44cceeb9c5a664fb4dca1d'},\n",
       " {'customer_id': 24816,\n",
       "  'salesstaff_id': 2,\n",
       "  'tel': 'cdba6e139e78d3bc2b1db83e8349983b'},\n",
       " {'customer_id': 24817,\n",
       "  'salesstaff_id': 30,\n",
       "  'tel': '48bc8dfcea7891291a76c8679c11ce11'},\n",
       " {'customer_id': 24818,\n",
       "  'salesstaff_id': 19,\n",
       "  'tel': '6f6dd932528b0a398ddf17dcbd465303'},\n",
       " {'customer_id': 24822,\n",
       "  'salesstaff_id': 18,\n",
       "  'tel': '79c53a15aa52b0a3c5f78b71c24956b7'},\n",
       " {'customer_id': 24829,\n",
       "  'salesstaff_id': 7,\n",
       "  'tel': '5e141d52f3637f311e1d2388bfe05f29'},\n",
       " {'customer_id': 25521,\n",
       "  'salesstaff_id': 15,\n",
       "  'tel': '6e72833bf3bc10b27fced307d990a2fa'},\n",
       " {'customer_id': 25526,\n",
       "  'salesstaff_id': 17,\n",
       "  'tel': 'f140dfd41b0edff6bdbb701009b53d46'},\n",
       " {'customer_id': 25546,\n",
       "  'salesstaff_id': 12,\n",
       "  'tel': 'd259354be5ed9d447c18d004cfa70b35'},\n",
       " {'customer_id': 25547,\n",
       "  'salesstaff_id': 28,\n",
       "  'tel': 'cf675b9923ef2197b852f5e7e9ce9244'},\n",
       " {'customer_id': 25549,\n",
       "  'salesstaff_id': 27,\n",
       "  'tel': '5a3138ef257e04d273e61d12350ab2e6'},\n",
       " {'customer_id': 25556,\n",
       "  'salesstaff_id': 9,\n",
       "  'tel': 'a6d3f11a703ae0e434fb5385ac8c2031'},\n",
       " {'customer_id': 25559,\n",
       "  'salesstaff_id': 5,\n",
       "  'tel': 'd107d2470ba72a473c41c703ee612346'},\n",
       " {'customer_id': 25962,\n",
       "  'salesstaff_id': 30,\n",
       "  'tel': '36ab9a4059484cbdbc1acfac506ac1a7'},\n",
       " {'customer_id': 25964,\n",
       "  'salesstaff_id': 17,\n",
       "  'tel': '6cfda4095d297ef4c224948baff71486'},\n",
       " {'customer_id': 26365,\n",
       "  'salesstaff_id': 24,\n",
       "  'tel': 'fdace0a5eb0ffc216ba30e413b39a3ea'},\n",
       " {'customer_id': 26367,\n",
       "  'salesstaff_id': 16,\n",
       "  'tel': '6eab019c1a4e8fb5de29c66d0d650699'},\n",
       " {'customer_id': 26369,\n",
       "  'salesstaff_id': 29,\n",
       "  'tel': '045a631f3a3864fa229ff75e7265dbbc'},\n",
       " {'customer_id': 27061,\n",
       "  'salesstaff_id': 19,\n",
       "  'tel': 'fd9b27f03f6cb940ccf29efaf55cd88a'},\n",
       " {'customer_id': 27065,\n",
       "  'salesstaff_id': 26,\n",
       "  'tel': '54827e84787649adb331fff3dc6b7a8f'},\n",
       " {'customer_id': 27068,\n",
       "  'salesstaff_id': 8,\n",
       "  'tel': '9540cb84de89b6b1acf5fd9ea70124ae'},\n",
       " {'customer_id': 27076,\n",
       "  'salesstaff_id': 18,\n",
       "  'tel': '8f6ca20b9a54eae0a13a2b1d769019d2'},\n",
       " {'customer_id': 27111,\n",
       "  'salesstaff_id': 3,\n",
       "  'tel': '7e28532d91d2f954223bf4704984c9d1'},\n",
       " {'customer_id': 27117,\n",
       "  'salesstaff_id': 11,\n",
       "  'tel': 'e55059524b50d5389fc9d3a3b5993da1'},\n",
       " {'customer_id': 27121,\n",
       "  'salesstaff_id': 23,\n",
       "  'tel': 'd5bf4184fa12e73527e0b9c151ad2bc9'},\n",
       " {'customer_id': 27523,\n",
       "  'salesstaff_id': 25,\n",
       "  'tel': '46c9e56a065055b93d19a053a85d6944'},\n",
       " {'customer_id': 27537,\n",
       "  'salesstaff_id': 22,\n",
       "  'tel': '77cdcbbb9f2e62218f4f1fb62ac3084c'},\n",
       " {'customer_id': 27837,\n",
       "  'salesstaff_id': 10,\n",
       "  'tel': '08477e5c9b54c088c9f8c99e5698ca59'},\n",
       " {'customer_id': 27843,\n",
       "  'salesstaff_id': 13,\n",
       "  'tel': 'e91903511446a4a29f5745e41cea2aba'},\n",
       " {'customer_id': 27844,\n",
       "  'salesstaff_id': 2,\n",
       "  'tel': '7076d242d88453e918e6aaa653b43b1e'},\n",
       " {'customer_id': 28140,\n",
       "  'salesstaff_id': 6,\n",
       "  'tel': '9e89a0b8be0dd89c2ea9c608d13ee53f'},\n",
       " {'customer_id': 28151,\n",
       "  'salesstaff_id': 14,\n",
       "  'tel': '4efd1368dad680868a5595003d7d9acc'},\n",
       " {'customer_id': 28152,\n",
       "  'salesstaff_id': 20,\n",
       "  'tel': '380504f27f85acb743e21ed4c9e57d60'},\n",
       " {'customer_id': 28442,\n",
       "  'salesstaff_id': 21,\n",
       "  'tel': '8568a35d3db80be71df99645df0dc8e1'},\n",
       " {'customer_id': 28457,\n",
       "  'salesstaff_id': 7,\n",
       "  'tel': '11d8da1100332658a9a23bca78e83316'},\n",
       " {'customer_id': 28458,\n",
       "  'salesstaff_id': 1,\n",
       "  'tel': '9eaeccbb982e9aa87f2f8b4625512bc3'},\n",
       " {'customer_id': 28798,\n",
       "  'salesstaff_id': 4,\n",
       "  'tel': '430cb654704188f461a3718d2fb24df6'},\n",
       " {'customer_id': 28814,\n",
       "  'salesstaff_id': 15,\n",
       "  'tel': '0beba6b422bfd0edd4d371fbfabdef8e'},\n",
       " {'customer_id': 28819,\n",
       "  'salesstaff_id': 6,\n",
       "  'tel': '03b0166e7159574a8f9429a6260f9e47'},\n",
       " {'customer_id': 29132,\n",
       "  'salesstaff_id': 24,\n",
       "  'tel': '71726ea77b1d4822b501a517527df26c'},\n",
       " {'customer_id': 29133,\n",
       "  'salesstaff_id': 26,\n",
       "  'tel': 'ad65fd417bdbf5994ea621067ace4a86'},\n",
       " {'customer_id': 29134,\n",
       "  'salesstaff_id': 25,\n",
       "  'tel': '418f87d7e75c6ad6e9df33b7eea326ba'},\n",
       " {'customer_id': 29135,\n",
       "  'salesstaff_id': 2,\n",
       "  'tel': '23e93426d7379ad339b59e4f41909aee'},\n",
       " {'customer_id': 29136,\n",
       "  'salesstaff_id': 17,\n",
       "  'tel': '65d7957b1e21842f957fbaffe4f49543'},\n",
       " {'customer_id': 29464,\n",
       "  'salesstaff_id': 7,\n",
       "  'tel': '25f890253794de931f2ada10cfb7e173'},\n",
       " {'customer_id': 29466,\n",
       "  'salesstaff_id': 8,\n",
       "  'tel': '86895c654423d93e60c5978742d7d0ad'},\n",
       " {'customer_id': 29484,\n",
       "  'salesstaff_id': 23,\n",
       "  'tel': 'cb3d817e78aa17b0b266770c791d6bbf'},\n",
       " {'customer_id': 29486,\n",
       "  'salesstaff_id': 15,\n",
       "  'tel': '6a9d1af4d87988282649f45c15b92fd2'},\n",
       " {'customer_id': 29488,\n",
       "  'salesstaff_id': 13,\n",
       "  'tel': '1a904c4d733b49cd2f4770eac2f47ed8'},\n",
       " {'customer_id': 29887,\n",
       "  'salesstaff_id': 12,\n",
       "  'tel': 'cde8850fc2a26e6ba63dde618d7afc17'},\n",
       " {'customer_id': 29889,\n",
       "  'salesstaff_id': 5,\n",
       "  'tel': '8fe152dc38c99250600ac50873fc0298'},\n",
       " {'customer_id': 29892,\n",
       "  'salesstaff_id': 4,\n",
       "  'tel': '478d1ac970fbdbeaa1eb57d419c35e72'},\n",
       " {'customer_id': 29896,\n",
       "  'salesstaff_id': 18,\n",
       "  'tel': '4f70d113b19f59016c87ecdcb8c2f9d2'},\n",
       " {'customer_id': 29897,\n",
       "  'salesstaff_id': 19,\n",
       "  'tel': '4550dcb5340befa3344c05bf67bc627f'}]"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def get_mission_data2():\n",
    "    data = []\n",
    "    cache_salesstaff_ids = set(salesstaff_ids)\n",
    "\n",
    "    for customer_id, groupby_customerid in df_last_mission.groupby('customer_id'):\n",
    "        # 手机号\n",
    "        tel = groupby_customerid['tel'].iloc[0]\n",
    "        cache2_salesstaff_ids = list(\n",
    "            cache_salesstaff_ids - set(groupby_customerid['salesstaff_id'].values.tolist())\n",
    "        )\n",
    "        if not cache2_salesstaff_ids:\n",
    "            cache_salesstaff_ids = set(salesstaff_ids)\n",
    "            cache2_salesstaff_ids = list(\n",
    "            cache_salesstaff_ids - set(groupby_customerid['salesstaff_id'].values.tolist())\n",
    "        )\n",
    "            \n",
    "        # 销售id    \n",
    "        choice_salesstaff_id =  random.choice(\n",
    "            cache2_salesstaff_ids\n",
    "        )\n",
    "        cache_salesstaff_ids = cache_salesstaff_ids - set([choice_salesstaff_id,])\n",
    "        data.append(\n",
    "                {\n",
    "                    'salesstaff_id':choice_salesstaff_id,\n",
    "                    'customer_id':customer_id,\n",
    "                    'tel':tel\n",
    "                }\n",
    "        )\n",
    "    return data\n",
    "        \n",
    "data2 = get_mission_data2()\n",
    "data2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_total = data1 + data2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>customer_id</th>\n",
       "      <th>salesstaff_id</th>\n",
       "      <th>tel</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>539</td>\n",
       "      <td>1</td>\n",
       "      <td>6f7602c534ce83d367b3c53a4f36c0b7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>540</td>\n",
       "      <td>1</td>\n",
       "      <td>d750c7b30e85efceb15f9838548fc085</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>541</td>\n",
       "      <td>1</td>\n",
       "      <td>4fcd26ac2390e3f54d1a72b87ba4c77c</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>542</td>\n",
       "      <td>1</td>\n",
       "      <td>7c134ea8df6ab6e78143eba0a3445e6e</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>543</td>\n",
       "      <td>1</td>\n",
       "      <td>0c883e4a18c193c84e9c4785adb4d847</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>544</td>\n",
       "      <td>1</td>\n",
       "      <td>19de7741b9d2fb317b820984cd7b46dd</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>545</td>\n",
       "      <td>1</td>\n",
       "      <td>ec9817ef0722f3c76138dbc83228dc4c</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>546</td>\n",
       "      <td>1</td>\n",
       "      <td>3271d5953121d680d7dbd6dc636d3e5d</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>547</td>\n",
       "      <td>1</td>\n",
       "      <td>5ecdda7fe15c3714f848a4f3e877b335</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>548</td>\n",
       "      <td>1</td>\n",
       "      <td>51267820d9645e83602584a17b31de10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>549</td>\n",
       "      <td>1</td>\n",
       "      <td>42ac663921f03535e93498584e213399</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>550</td>\n",
       "      <td>1</td>\n",
       "      <td>28434be616a48e3afd41fad989618c59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>551</td>\n",
       "      <td>1</td>\n",
       "      <td>bb291924c8ffd9ff2e44b1ed0f3f4ab3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>552</td>\n",
       "      <td>1</td>\n",
       "      <td>baf8047a1550beb98d4ec50f73dc68ef</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>553</td>\n",
       "      <td>1</td>\n",
       "      <td>684d2daf7e56a338a753a9f86406eab1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>554</td>\n",
       "      <td>1</td>\n",
       "      <td>a1b8ce7cb0a43f156e2eaed3bfe3a1de</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>555</td>\n",
       "      <td>1</td>\n",
       "      <td>c74db03d9a6a4f8ba710ae90443ea5a7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>556</td>\n",
       "      <td>1</td>\n",
       "      <td>234277677a301203b2369544d52c40a6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>557</td>\n",
       "      <td>1</td>\n",
       "      <td>dc50a84b1163f535cb5712627ad5074c</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>558</td>\n",
       "      <td>1</td>\n",
       "      <td>1365f5ae48dbedeb7a3eb77c544ec744</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>559</td>\n",
       "      <td>1</td>\n",
       "      <td>5c31eb0fe13a69cde0ed215a62916f2a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>560</td>\n",
       "      <td>1</td>\n",
       "      <td>49583e3c50188987c3d4c7fa9e976ce8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>561</td>\n",
       "      <td>1</td>\n",
       "      <td>b876d76916a8e59fcd3a3d93df1eb074</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>562</td>\n",
       "      <td>1</td>\n",
       "      <td>8c46781ac04196a16a12d1ab3558bafd</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>563</td>\n",
       "      <td>1</td>\n",
       "      <td>1207bb574951d508de0d767f41635326</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>487</td>\n",
       "      <td>20</td>\n",
       "      <td>a12ddddece31a06b674e41d00c120a35</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>517</td>\n",
       "      <td>8</td>\n",
       "      <td>ec4424adedf2ec7fc48c3bfeed54ef25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>518</td>\n",
       "      <td>9</td>\n",
       "      <td>1090f73bb072604a7a7109d0c641306b</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>521</td>\n",
       "      <td>11</td>\n",
       "      <td>c098a8f2bddc66cc97034adaa78d3f01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>1034</td>\n",
       "      <td>30</td>\n",
       "      <td>80b0c7a8493a547b37fa691064119606</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>309</th>\n",
       "      <td>27121</td>\n",
       "      <td>23</td>\n",
       "      <td>d5bf4184fa12e73527e0b9c151ad2bc9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>310</th>\n",
       "      <td>27523</td>\n",
       "      <td>25</td>\n",
       "      <td>46c9e56a065055b93d19a053a85d6944</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>311</th>\n",
       "      <td>27537</td>\n",
       "      <td>22</td>\n",
       "      <td>77cdcbbb9f2e62218f4f1fb62ac3084c</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>312</th>\n",
       "      <td>27837</td>\n",
       "      <td>10</td>\n",
       "      <td>08477e5c9b54c088c9f8c99e5698ca59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>313</th>\n",
       "      <td>27843</td>\n",
       "      <td>13</td>\n",
       "      <td>e91903511446a4a29f5745e41cea2aba</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>314</th>\n",
       "      <td>27844</td>\n",
       "      <td>2</td>\n",
       "      <td>7076d242d88453e918e6aaa653b43b1e</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>315</th>\n",
       "      <td>28140</td>\n",
       "      <td>6</td>\n",
       "      <td>9e89a0b8be0dd89c2ea9c608d13ee53f</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>316</th>\n",
       "      <td>28151</td>\n",
       "      <td>14</td>\n",
       "      <td>4efd1368dad680868a5595003d7d9acc</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>317</th>\n",
       "      <td>28152</td>\n",
       "      <td>20</td>\n",
       "      <td>380504f27f85acb743e21ed4c9e57d60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>318</th>\n",
       "      <td>28442</td>\n",
       "      <td>21</td>\n",
       "      <td>8568a35d3db80be71df99645df0dc8e1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>319</th>\n",
       "      <td>28457</td>\n",
       "      <td>7</td>\n",
       "      <td>11d8da1100332658a9a23bca78e83316</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>320</th>\n",
       "      <td>28458</td>\n",
       "      <td>1</td>\n",
       "      <td>9eaeccbb982e9aa87f2f8b4625512bc3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>321</th>\n",
       "      <td>28798</td>\n",
       "      <td>4</td>\n",
       "      <td>430cb654704188f461a3718d2fb24df6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>322</th>\n",
       "      <td>28814</td>\n",
       "      <td>15</td>\n",
       "      <td>0beba6b422bfd0edd4d371fbfabdef8e</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>323</th>\n",
       "      <td>28819</td>\n",
       "      <td>6</td>\n",
       "      <td>03b0166e7159574a8f9429a6260f9e47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>324</th>\n",
       "      <td>29132</td>\n",
       "      <td>24</td>\n",
       "      <td>71726ea77b1d4822b501a517527df26c</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>325</th>\n",
       "      <td>29133</td>\n",
       "      <td>26</td>\n",
       "      <td>ad65fd417bdbf5994ea621067ace4a86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>326</th>\n",
       "      <td>29134</td>\n",
       "      <td>25</td>\n",
       "      <td>418f87d7e75c6ad6e9df33b7eea326ba</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>327</th>\n",
       "      <td>29135</td>\n",
       "      <td>2</td>\n",
       "      <td>23e93426d7379ad339b59e4f41909aee</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>328</th>\n",
       "      <td>29136</td>\n",
       "      <td>17</td>\n",
       "      <td>65d7957b1e21842f957fbaffe4f49543</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>329</th>\n",
       "      <td>29464</td>\n",
       "      <td>7</td>\n",
       "      <td>25f890253794de931f2ada10cfb7e173</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>330</th>\n",
       "      <td>29466</td>\n",
       "      <td>8</td>\n",
       "      <td>86895c654423d93e60c5978742d7d0ad</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>331</th>\n",
       "      <td>29484</td>\n",
       "      <td>23</td>\n",
       "      <td>cb3d817e78aa17b0b266770c791d6bbf</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>332</th>\n",
       "      <td>29486</td>\n",
       "      <td>15</td>\n",
       "      <td>6a9d1af4d87988282649f45c15b92fd2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>333</th>\n",
       "      <td>29488</td>\n",
       "      <td>13</td>\n",
       "      <td>1a904c4d733b49cd2f4770eac2f47ed8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>334</th>\n",
       "      <td>29887</td>\n",
       "      <td>12</td>\n",
       "      <td>cde8850fc2a26e6ba63dde618d7afc17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>335</th>\n",
       "      <td>29889</td>\n",
       "      <td>5</td>\n",
       "      <td>8fe152dc38c99250600ac50873fc0298</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>336</th>\n",
       "      <td>29892</td>\n",
       "      <td>4</td>\n",
       "      <td>478d1ac970fbdbeaa1eb57d419c35e72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>337</th>\n",
       "      <td>29896</td>\n",
       "      <td>18</td>\n",
       "      <td>4f70d113b19f59016c87ecdcb8c2f9d2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>338</th>\n",
       "      <td>29897</td>\n",
       "      <td>19</td>\n",
       "      <td>4550dcb5340befa3344c05bf67bc627f</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>339 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     customer_id  salesstaff_id                               tel\n",
       "0            539              1  6f7602c534ce83d367b3c53a4f36c0b7\n",
       "1            540              1  d750c7b30e85efceb15f9838548fc085\n",
       "2            541              1  4fcd26ac2390e3f54d1a72b87ba4c77c\n",
       "3            542              1  7c134ea8df6ab6e78143eba0a3445e6e\n",
       "4            543              1  0c883e4a18c193c84e9c4785adb4d847\n",
       "5            544              1  19de7741b9d2fb317b820984cd7b46dd\n",
       "6            545              1  ec9817ef0722f3c76138dbc83228dc4c\n",
       "7            546              1  3271d5953121d680d7dbd6dc636d3e5d\n",
       "8            547              1  5ecdda7fe15c3714f848a4f3e877b335\n",
       "9            548              1  51267820d9645e83602584a17b31de10\n",
       "10           549              1  42ac663921f03535e93498584e213399\n",
       "11           550              1  28434be616a48e3afd41fad989618c59\n",
       "12           551              1  bb291924c8ffd9ff2e44b1ed0f3f4ab3\n",
       "13           552              1  baf8047a1550beb98d4ec50f73dc68ef\n",
       "14           553              1  684d2daf7e56a338a753a9f86406eab1\n",
       "15           554              1  a1b8ce7cb0a43f156e2eaed3bfe3a1de\n",
       "16           555              1  c74db03d9a6a4f8ba710ae90443ea5a7\n",
       "17           556              1  234277677a301203b2369544d52c40a6\n",
       "18           557              1  dc50a84b1163f535cb5712627ad5074c\n",
       "19           558              1  1365f5ae48dbedeb7a3eb77c544ec744\n",
       "20           559              1  5c31eb0fe13a69cde0ed215a62916f2a\n",
       "21           560              1  49583e3c50188987c3d4c7fa9e976ce8\n",
       "22           561              1  b876d76916a8e59fcd3a3d93df1eb074\n",
       "23           562              1  8c46781ac04196a16a12d1ab3558bafd\n",
       "24           563              1  1207bb574951d508de0d767f41635326\n",
       "25           487             20  a12ddddece31a06b674e41d00c120a35\n",
       "26           517              8  ec4424adedf2ec7fc48c3bfeed54ef25\n",
       "27           518              9  1090f73bb072604a7a7109d0c641306b\n",
       "28           521             11  c098a8f2bddc66cc97034adaa78d3f01\n",
       "29          1034             30  80b0c7a8493a547b37fa691064119606\n",
       "..           ...            ...                               ...\n",
       "309        27121             23  d5bf4184fa12e73527e0b9c151ad2bc9\n",
       "310        27523             25  46c9e56a065055b93d19a053a85d6944\n",
       "311        27537             22  77cdcbbb9f2e62218f4f1fb62ac3084c\n",
       "312        27837             10  08477e5c9b54c088c9f8c99e5698ca59\n",
       "313        27843             13  e91903511446a4a29f5745e41cea2aba\n",
       "314        27844              2  7076d242d88453e918e6aaa653b43b1e\n",
       "315        28140              6  9e89a0b8be0dd89c2ea9c608d13ee53f\n",
       "316        28151             14  4efd1368dad680868a5595003d7d9acc\n",
       "317        28152             20  380504f27f85acb743e21ed4c9e57d60\n",
       "318        28442             21  8568a35d3db80be71df99645df0dc8e1\n",
       "319        28457              7  11d8da1100332658a9a23bca78e83316\n",
       "320        28458              1  9eaeccbb982e9aa87f2f8b4625512bc3\n",
       "321        28798              4  430cb654704188f461a3718d2fb24df6\n",
       "322        28814             15  0beba6b422bfd0edd4d371fbfabdef8e\n",
       "323        28819              6  03b0166e7159574a8f9429a6260f9e47\n",
       "324        29132             24  71726ea77b1d4822b501a517527df26c\n",
       "325        29133             26  ad65fd417bdbf5994ea621067ace4a86\n",
       "326        29134             25  418f87d7e75c6ad6e9df33b7eea326ba\n",
       "327        29135              2  23e93426d7379ad339b59e4f41909aee\n",
       "328        29136             17  65d7957b1e21842f957fbaffe4f49543\n",
       "329        29464              7  25f890253794de931f2ada10cfb7e173\n",
       "330        29466              8  86895c654423d93e60c5978742d7d0ad\n",
       "331        29484             23  cb3d817e78aa17b0b266770c791d6bbf\n",
       "332        29486             15  6a9d1af4d87988282649f45c15b92fd2\n",
       "333        29488             13  1a904c4d733b49cd2f4770eac2f47ed8\n",
       "334        29887             12  cde8850fc2a26e6ba63dde618d7afc17\n",
       "335        29889              5  8fe152dc38c99250600ac50873fc0298\n",
       "336        29892              4  478d1ac970fbdbeaa1eb57d419c35e72\n",
       "337        29896             18  4f70d113b19f59016c87ecdcb8c2f9d2\n",
       "338        29897             19  4550dcb5340befa3344c05bf67bc627f\n",
       "\n",
       "[339 rows x 3 columns]"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_new_mission = pd.DataFrame(\n",
    "    data_total\n",
    ")\n",
    "df_new_mission"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_new_mission.to_sql(\n",
    "    '2020-07-01-mission',\n",
    "    conn,\n",
    "    index=False\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>customer_id</th>\n",
       "      <th>salesstaff_id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>539</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>540</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>541</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>542</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>543</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>544</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>545</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>546</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>547</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>548</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>549</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>550</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>551</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>552</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>553</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>554</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>555</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>556</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>557</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>558</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>559</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>560</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>561</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>562</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>563</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>487</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>517</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>518</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>521</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>1034</td>\n",
       "      <td>30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>309</th>\n",
       "      <td>27121</td>\n",
       "      <td>23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>310</th>\n",
       "      <td>27523</td>\n",
       "      <td>25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>311</th>\n",
       "      <td>27537</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>312</th>\n",
       "      <td>27837</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>313</th>\n",
       "      <td>27843</td>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>314</th>\n",
       "      <td>27844</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>315</th>\n",
       "      <td>28140</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>316</th>\n",
       "      <td>28151</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>317</th>\n",
       "      <td>28152</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>318</th>\n",
       "      <td>28442</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>319</th>\n",
       "      <td>28457</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>320</th>\n",
       "      <td>28458</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>321</th>\n",
       "      <td>28798</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>322</th>\n",
       "      <td>28814</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>323</th>\n",
       "      <td>28819</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>324</th>\n",
       "      <td>29132</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>325</th>\n",
       "      <td>29133</td>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>326</th>\n",
       "      <td>29134</td>\n",
       "      <td>25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>327</th>\n",
       "      <td>29135</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>328</th>\n",
       "      <td>29136</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>329</th>\n",
       "      <td>29464</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>330</th>\n",
       "      <td>29466</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>331</th>\n",
       "      <td>29484</td>\n",
       "      <td>23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>332</th>\n",
       "      <td>29486</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>333</th>\n",
       "      <td>29488</td>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>334</th>\n",
       "      <td>29887</td>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>335</th>\n",
       "      <td>29889</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>336</th>\n",
       "      <td>29892</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>337</th>\n",
       "      <td>29896</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>338</th>\n",
       "      <td>29897</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>339 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     customer_id  salesstaff_id\n",
       "0            539              1\n",
       "1            540              1\n",
       "2            541              1\n",
       "3            542              1\n",
       "4            543              1\n",
       "5            544              1\n",
       "6            545              1\n",
       "7            546              1\n",
       "8            547              1\n",
       "9            548              1\n",
       "10           549              1\n",
       "11           550              1\n",
       "12           551              1\n",
       "13           552              1\n",
       "14           553              1\n",
       "15           554              1\n",
       "16           555              1\n",
       "17           556              1\n",
       "18           557              1\n",
       "19           558              1\n",
       "20           559              1\n",
       "21           560              1\n",
       "22           561              1\n",
       "23           562              1\n",
       "24           563              1\n",
       "25           487             20\n",
       "26           517              8\n",
       "27           518              9\n",
       "28           521             11\n",
       "29          1034             30\n",
       "..           ...            ...\n",
       "309        27121             23\n",
       "310        27523             25\n",
       "311        27537             22\n",
       "312        27837             10\n",
       "313        27843             13\n",
       "314        27844              2\n",
       "315        28140              6\n",
       "316        28151             14\n",
       "317        28152             20\n",
       "318        28442             21\n",
       "319        28457              7\n",
       "320        28458              1\n",
       "321        28798              4\n",
       "322        28814             15\n",
       "323        28819              6\n",
       "324        29132             24\n",
       "325        29133             26\n",
       "326        29134             25\n",
       "327        29135              2\n",
       "328        29136             17\n",
       "329        29464              7\n",
       "330        29466              8\n",
       "331        29484             23\n",
       "332        29486             15\n",
       "333        29488             13\n",
       "334        29887             12\n",
       "335        29889              5\n",
       "336        29892              4\n",
       "337        29896             18\n",
       "338        29897             19\n",
       "\n",
       "[339 rows x 2 columns]"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_new_mission=df_new_mission.drop('tel',axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>customer_id</th>\n",
       "      <th>salesstaff_id</th>\n",
       "      <th>createDate</th>\n",
       "      <th>status_id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>539</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-07-01</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>540</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-07-01</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>541</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-07-01</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>542</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-07-01</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>543</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-07-01</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   customer_id  salesstaff_id  createDate  status_id\n",
       "0          539              1  2020-07-01          7\n",
       "1          540              1  2020-07-01          7\n",
       "2          541              1  2020-07-01          7\n",
       "3          542              1  2020-07-01          7\n",
       "4          543              1  2020-07-01          7"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_new_mission['createDate'] = current_day\n",
    "df_new_mission['status_id'] = 7\n",
    "df_new_mission.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_new_mission.to_sql(\n",
    "    'mission',\n",
    "    conn,\n",
    "    index=False,\n",
    "    if_exists='append',\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [],
   "source": [
    "writer = pd.ExcelWriter('mission.xlsx')\n",
    "df_new_mission.to_excel(writer)\n",
    "writer.save()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
